﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Arrays.cs" company="JDML Consulting Ltd.">
//   Copyright 2011 Photon Project - http://photon.codeplex.com
// </copyright>
// <summary>
//   Defines the Arrays type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Photon.Collections
{
    using System.Collections.Generic;

    public static class Arrays
    {
        public static int CopyFrom<T>(this T[] instance, IEnumerable<T> items, int index = 0)
        {
            var targetIndex = index;
            foreach (var item in items)
            {
                instance[targetIndex++] = item;
            }
            
            return targetIndex - index;
        }
    }
}
